home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / tcoop.arc / TCOOP2.ARC / TWSOUNIT.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1991-10-26  |  2.9 KB  |  92 lines

  1. // twsounit.cpp: Twso Class Implementation
  2. #include "twsounit.h"
  3.  
  4. Wso::Wso(int Ba, int Fa, ColorPak &Cp)
  5. // Initializes a text window screen object by typing the 
  6. // Iso's panel to be a Tfso. 
  7. : Iso(new Tfso(Ba,Fa,Cp))
  8. {
  9.   return; // Nothing else to do
  10. }
  11.  
  12. void Wso::MoveLoop(MsgPkt &M)
  13. // The move loop drags a skeleton outline around, and 
  14. // when the mouse button is released, the Wso is moved to the
  15. // same location as the skeleton. If the Wso does not have the 
  16. // "outline move" attribute, the Wso is dragged directly. 
  17. {
  18.   Tskel *Red;
  19.   Iso   *Skeleton;
  20.  
  21.   if (Panel->IsSwappable()) {
  22.     if ((Panel->Fattr & OutlineMove) != 0) {
  23.        Red = new Tskel(Panel->Colors);
  24.        Red->SetSize(Panel->Interior->Wd, Panel->Interior->Ht);
  25.        Skeleton = new Iso(Red);
  26.        Skeleton->Open(Base,
  27.                       Panel->Frame->Xul-Base->Panel->Interior->Xul,
  28.                       Panel->Frame->Yul-Base->Panel->Interior->Yul);
  29.        Skeleton->MoveLoop(M);
  30.        Skeleton->Remove();
  31.        if ((Panel->Frame->Xul != Skeleton->Panel->Frame->Xul) ||
  32.            (Panel->Frame->Yul != Skeleton->Panel->Frame->Yul)) 
  33.        Move(Skeleton->Panel->Frame->Xul,
  34.             Skeleton->Panel->Frame->Yul);
  35.        delete Skeleton;
  36.     }
  37.     else { // Call inherited version which moves the whole window
  38.       Iso::MoveLoop(M);
  39.     } 
  40.   }
  41. }
  42.  
  43. void Wso::StretchLoop(MsgPkt &M)
  44. // Very similar to MoveLoop 
  45. {
  46.   Tskel *Red;
  47.   Iso   *Skeleton;
  48.  
  49.   if (Panel->IsStretchable()) {
  50.     if ((Panel->Fattr & OutlineMove) != 0) {
  51.        Red = new Tskel(Panel->Colors);
  52.        Red->SetSize(Panel->Interior->Wd, Panel->Interior->Ht);
  53.        Skeleton = new Iso(Red);
  54.        Skeleton->Open(Base,
  55.                       Panel->Frame->Xul-Base->Panel->Interior->Xul,
  56.                       Panel->Frame->Yul-Base->Panel->Interior->Yul);
  57.        Skeleton->StretchLoop(M);
  58.        Skeleton->Remove();
  59.        if ((Panel->Frame->Wd != Skeleton->Panel->Frame->Wd) ||
  60.            (Panel->Frame->Ht != Skeleton->Panel->Frame->Ht)) 
  61.        // Need to subtract borders from size
  62.        Stretch(Skeleton->Panel->Frame->Wd-2,
  63.                Skeleton->Panel->Frame->Ht-2);
  64.        delete Skeleton;
  65.     }
  66.     else { // Call inherited version which stretches the whole window
  67.       Iso::StretchLoop(M);
  68.     } 
  69.   }
  70. }
  71.  
  72. void Wso::Prompt(void)
  73. // Prompts by drawing a double border (if there is a border) 
  74. {
  75.   Iso::Prompt(); // Do inherited prompting
  76.   if ((Panel->Bstyle > 0) &&
  77.       ((Panel->Fattr & BorderPrompt) != 0))  
  78.      Panel->DrawFrame(Double + Panel->Bwd, 0);
  79. }
  80.  
  81. void Wso::UnPrompt(void)
  82. // Unprompts by restoring the border to its original attributes 
  83. {
  84.   if (Active) {
  85.      if ((Panel->Bstyle > 0) && 
  86.          ((Panel->Fattr & BorderPrompt) != 0))  
  87.         Panel->DrawFrame(0, 0); // 0, 0 means use default 
  88.      Iso::UnPrompt(); // Do inherited unprompting
  89.   }
  90. }
  91.  
  92.